Understanding and Using Dot Variables

Description

After you create a pointer variable, you may add to it any number of "child" variables of different types. These are known as dot variables.

dim ptr as P
dim ptr.lastname as C
dim ptr.birthday as D
dim ptr.age as N
dim ptr.spouse as P
dim ptr.spouse.firstname as C
dim ptr.children[3] as P
dim ptr.children[3].firstname as C
dim ptr.children[3].age as N

As the sample code above illustrates, a pointer variable may have pointers as child variables. These variables, can have their own child variables of any type. Any variable can also be created as an array with multiple elements. One benefit of dot variables is that you may send the whole family of variables to a function (in this case named foo ) by simply sending the base level pointer variable ( ptr ).

foo(ptr)

In this example the foo() function can read and write ptr.birthday, ptr.spouse.firstname, or any of the other child variables.